package org.prem.jb.hibernate.onetomany;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;

import org.prem.jb.hibernate.onetomany.Student;

@Entity(name="VEHICLE_ONE2MANY_T")
public class Vehicle {

	@Id @GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="vec_id")
	private int vehicleId;
	
	private String vehicleName;
	
	@ManyToOne(cascade=CascadeType.ALL)
	@JoinTable(name="USER_VEHICLE",joinColumns=@JoinColumn(name="VEHICLE_ID"),
	inverseJoinColumns=@JoinColumn(name="USER_ID"))
	private Student student;

	public int getVehicleId() {
		return vehicleId;
	}

	public void setVehicleId(int vehicleId) {
		this.vehicleId = vehicleId;
	}

	public String getVehicleName() {
		return vehicleName;
	}

	public void setVehicleName(String vehicleName) {
		this.vehicleName = vehicleName;
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}
	
}
